<div ng-if="!user.id">
  Loading...
</div>
<div ng-if="user.id">
  <h1>{{user.username}}#{{user.id}}
    <small ng-if="isSelf"> (self)</small>
    <small>{{characters.length|number}} characters</small>
  </h1>

  <p ng-if="isSelf">
    <a ng-href="#/user/{{userSlug}}/character/new" class="btn btn-default"><!--span class="fa fa-user-plus"--><span class="glyphicon glyphicon-plus"></span> Create a New Character</a>
    <a class="btn btn-default disabled"><span class="glyphicon glyphicon-import"></span> Import Open League Character (TODO)</a>
    <a class="pull-right btn btn-default disabled"><span class="glyphicon glyphicon-cog"></span> Options (TODO)</a>
  </p>
  
  <ul class="list-unstyled">
    <li ng-repeat="character in characters" class="well">
      <p>
        <a ng-class="{disabled:character.league.isPlayable}" href="#/character/{{character.id}}">{{character.name}}</a>
        - {{character.league.label}}.
        Last played {{character.updatedAt.fromNow()}}.
        <span ng-if="character.deleted">DELETED</span>
        <span class="pull-right" ng-if="isSelf">
          <button ng-if="character.league.name == 'open'" ng-click="onDupe(character)" class="btn btn-default"><span class="fa fa-copy"></span> Duplicate</button>
          <button ng-if="character.league.name == 'open'" class="btn btn-default disabled"><span class="glyphicon glyphicon-export"></span> Export</button>
          <button ng-click="onDelete(character)" class="btn btn-default"><span class="glyphicon glyphicon-remove"></span> Delete</button>
        </span>
      </p>
      <p>
        <span ng-if="character.state.unittypes.ascension > 0">{{character.state.unittypes.ascension| bignum}} ascensions,</span>
        <span ng-if="character.state.unittypes.ascension > 0 || character.state.unittypes.nexus > 0">{{character.state.unittypes.nexus | bignum}} nexus,</span>
        {{character.state.upgrades.hatchery || 0 | bignum}} hatcheries,
        {{character.state.upgrades.expansion || 0 | bignum}} expansions.
      </p>
      <!--a ng-href="#/character/{{character.id}}" class="btn btn-default">Play</a-->
    </li>
  </ul>
</div>
